﻿@using Guan.CMS.Common.Framework
@model IEnumerable<Guan.CMS.Model.Entity.File>
@{
    ViewBag.Title = "文件管理";
    ViewBag.SectionTitleImage = "ico-content.png";
}
<div class="section-header">
    <div class="title">
        @if (ViewBag.SectionTitleImage != null)
        {
            <img src="@Url.Content("~/Content/Images/Admin/" + ViewBag.SectionTitleImage)" alt="" />
        }
        @ViewBag.Title
    </div>
    <div class="options">
        @Html.ActionLink("添加文件","Index",null,new{@class="k-button"})
    </div>
</div>
<div class="section-body">
    @(Html.Kendo().Grid(Model)
      .Name("file-grid")
      .Columns(columns =>
                   {
                       columns.Bound(m => m.Id).Width(50);
                       columns.Bound(m => m.Path)
                              .Template(@<text>
                                             @if (item.FileType == "image")
                                             {
                                                 <a href="@Url.Action("Detail","FileManager",new{id=item.Id})" title="@item.FullName">
                                                     <img src="@Url.Content(item.Path)" style="max-width:150px;" alt="@item.FullName"/>
                                                 </a>
                                             }
                                             else
                                             {
                                                 <a href="@Url.Action("Detail","FileManager",new{id=item.Id})" title="@item.FullName">@item.FullName</a>
                                             }
                                         </text>).Title("文件");
                       columns.Bound(m => m.FullName);
                       columns.Bound(m => m.FileType);
                       columns.Template(m => Html.ActionLink("查看", "Detail", new {id = m.Id}))
                           //.ClientTemplate("<a href=\"Edit/#= Id #\">编辑</a>")
                           .Title("查看").Centered().Width(50);
                   }
      ).Groupable().Pageable(p => p.PageSizes(new[]{10,20,50,100})).Sortable().Scrollable().Filterable()
          //.DataSource(dataSource => dataSource.Ajax().Read(read => read.Action("ListAjax", "FileManager")).PageSize(20))
      )
</div>